import { createRouter, createWebHashHistory, createWebHistory } from "vue-router"

const routes = [
  {
    path: '/',
    redirect: '/about'
  },
  {
    path: '/index',
    component: () => import('@/pages/index.vue'),
    children: [
      {
        path: '/about',
        component: () => import('@/pages/About.vue')
      },
      {
        path: '/news',
        component: () => import('@/pages/News.vue')
      }
    ]
  },
  {
    path: '/NewsDetails',
    component: () => import('@/pages/NewsDetails.vue')
  }
]
const router = createRouter({
  // 4. 采用hash 模式
  history: createWebHashHistory(),
  // 采用 history 模式
  // history: createWebHistory(),
  routes, // short for `routes: routes`
})

export default router
